home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 7
/
FM Towns Free Software Collection 7.iso
/
ms_dos
/
dmove86
/
sectbl.c
< prev
Wrap
Text File
|
1993-11-30
|
1KB
|
66 lines
/*
sectbl.c -- control()の下請け;セクタテーブルの処理
*/
#include<stdio.h>
#include<dos.h>
#include<malloc.h>
#include"dmove86.h"
void freesectbl(sectbl)
struct SECTBL *sectbl;
{
struct SECTBL *tblfree;
while (sectbl != NULL)
{
tblfree = sectbl;
farfree(tblfree->buf);
sectbl = tblfree->next;
free(tblfree);
}
}
extern struct DPB Dpb;
extern int Drive;
void writedir(sectbl,dirtbl,dirnum)
struct SECTBL *sectbl;
struct DIRENTRY far **dirtbl;
unsigned int dirnum;
{
struct DIRENTRY far *buftop =
(struct DIRENTRY far *)farmalloc(Dpb.seclen);
struct DIRENTRY far *buf;
int i;
unsigned n;
if (buftop == NULL)
{
dm_errmes("メモリ不足で書き込めません");
goto ENDWRITING;
}
while (sectbl != NULL)
{
buf = buftop;
for (i=0 ; i<DIRSEC ; i++)
*(buf++) = **(dirtbl++); /* 構造体のコピー */
if ((n=wrabssec(buftop, sectbl->num, Drive)) & 0x100)
{
dm_errmes("書き込みエラーです");
goto ENDWRITING;
}
sectbl = sectbl->next;
}
ENDWRITING:;
farfree(buftop);
}